<?php

$wpsary_version = get_option('wpsary_version');

//I put here any table update

function wpsary_install () {
   global $wpdb;

   $album_table_name = $wpdb->prefix . "wpsary_album";
   if($wpdb->get_var("show tables like '$album_table_name'") != $album_table_name) {
      
		$sql = "CREATE TABLE ".$album_table_name." (
		id mediumint(9) NOT NULL AUTO_INCREMENT,
		title varchar(255) DEFAULT '' NOT NULL,
		description text NOT NULL,
		metadata text NOT NULL,
		UNIQUE KEY id (id)
		);";
		$wpdb->query($sql);
   }

   $images_table_name = $wpdb->prefix . "wpsary_images";
   if($wpdb->get_var("show tables like '$images_table_name'") != $images_table_name) {

		$sql = "CREATE TABLE ".$images_table_name." (
		id mediumint(9) NOT NULL AUTO_INCREMENT,
		albumID mediumint(9) DEFAULT '0' NOT NULL,
		title varchar(255) DEFAULT '' NOT NULL,
		description text NOT NULL,
		metadata text NOT NULL,
		UNIQUE KEY id (id)
		);";
		$wpdb->query($sql);
   }
}

?>
